<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
	xmlns:layout="http://www.ultraq.net.nz/web/thymeleaf/layout">
<head th:replace="dashboard/header :: header"></head>
<body>

	<!--
@desc  添加
@author WeiXiaoJin
@since 2020-01-30 11:21:01
-->
	<div layout:fragment="content">
		<div class="container-fluid content-main">
			<div class="animated fadeIn">
				<div class="row">
					<!-- /.col-->
					<div class="col-sm-12">
						<div class="card">
							<div class="card-body">
								<form class="form-horizontal" id="addForm">
									<!-- 
									<div class="form-group row">
										<label class="col-md-2 col-form-label control-label"
											for="text-input">选择器id</label>
										<div class="col-md-9">
											<input class="form-control" id="selectorId" type="text"
												name="selectorId" placeholder="选择器id">
										</div>
									</div>
									<div class="form-group row">
										<label class="col-md-2 col-form-label control-label"
											for="text-input">匹配方式（0 and 1 or)</label>
										<div class="col-md-9">
											<input class="form-control" id="matchMode" type="text"
												name="matchMode" placeholder="匹配方式（0 and  1 or)">
										</div>
									</div>
									<div class="form-group row">
										<label class="col-md-2 col-form-label control-label"
											for="text-input">规则名称</label>
										<div class="col-md-9">
											<input class="form-control" id="name" type="text" name="name"
												placeholder="规则名称">
										</div>
									</div>
									<div class="form-group row">
										<label class="col-md-2 col-form-label control-label"
											for="text-input">是否开启</label>
										<div class="col-md-9">
											<input class="form-control" id="enabled" type="text"
												name="enabled" placeholder="是否开启">
										</div>
									</div>
									<div class="form-group row">
										<label class="col-md-2 col-form-label control-label"
											for="text-input">是否记录日志</label>
										<div class="col-md-9">
											<input class="form-control" id="loged" type="text"
												name="loged" placeholder="是否记录日志">
										</div>
									</div>
									<div class="form-group row">
										<label class="col-md-2 col-form-label control-label"
											for="text-input">排序</label>
										<div class="col-md-9">
											<input class="form-control" id="sort" type="text" name="sort"
												placeholder="排序">
										</div>
									</div>
									<div class="form-group row">
										<label class="col-md-2 col-form-label control-label"
											for="text-input">处理逻辑（此处针对不同的插件，会有不同的字段来标识不同的处理，所有存储json格式数据）</label>
										<div class="col-md-9">
											<input class="form-control" id="handle" type="text"
												name="handle"
												placeholder="处理逻辑（此处针对不同的插件，会有不同的字段来标识不同的处理，所有存储json格式数据）">
										</div>
									</div>
									<div class="form-group row">
										<label class="col-md-2 col-form-label control-label"
											for="text-input">创建时间</label>
										<div class="col-md-9">
											<div class="input-group date">
												<span class="input-group-addon"><i
													class="fa fa-calendar"></i></span> <input type="text"
													class="form-control time-input" id="dateCreated-3"
													name="dateCreated" data-type="datetime"
													data-format="yyyy-MM-dd HH:mm:ss"
													placeholder="yyyy-MM-dd HH:mm:ss" lay-key="dateCreated-3">
											</div>
										</div>
									</div>
									<div class="form-group row">
										<label class="col-md-2 col-form-label control-label"
											for="text-input">更新时间</label>
										<div class="col-md-9">
											<div class="input-group date">
												<span class="input-group-addon"><i
													class="fa fa-calendar"></i></span> <input type="text"
													class="form-control time-input" id="dateUpdated-3"
													name="dateUpdated" data-type="datetime"
													data-format="yyyy-MM-dd HH:mm:ss"
													placeholder="yyyy-MM-dd HH:mm:ss" lay-key="dateUpdated-3">
											</div>
										</div>
									</div>
									<div class="form-group row">
										<label class="col-md-2 col-form-label control-label"
											for="text-input">接受IP</label>
										<div class="col-md-9">
											<input class="form-control" id="accessip" type="text"
												name="accessip" placeholder="接受IP">
										</div>
									</div>
									<div class="form-group row">
										<label class="col-md-2 col-form-label control-label"
											for="text-input">认证类型</label>
										<div class="col-md-9">
											<input class="form-control" id="authType" type="text"
												name="authType" placeholder="认证类型">
										</div>
									</div>
									<div class="form-group row">
										<label class="col-md-2 col-form-label control-label"
											for="text-input">客户端超时</label>
										<div class="col-md-9">
											<input class="form-control" id="clientOuttime" type="text"
												name="clientOuttime" placeholder="客户端超时">
										</div>
									</div>
									<div class="form-group row">
										<label class="col-md-2 col-form-label control-label"
											for="text-input">限制IP</label>
										<div class="col-md-9">
											<input class="form-control" id="denyip" type="text"
												name="denyip" placeholder="限制IP">
										</div>
									</div>
									<div class="form-group row">
										<label class="col-md-2 col-form-label control-label"
											for="text-input">加密方式</label>
										<div class="col-md-9">
											<input class="form-control" id="encType" type="text"
												name="encType" placeholder="加密方式">
										</div>
									</div>
									<div class="form-group row">
										<label class="col-md-2 col-form-label control-label"
											for="text-input">是否加密</label>
										<div class="col-md-9">
											<input class="form-control" id="hasEncryption" type="text"
												name="hasEncryption" placeholder="是否加密">
										</div>
									</div>
									<div class="form-group row">
										<label class="col-md-2 col-form-label control-label"
											for="text-input">是否熔断</label>
										<div class="col-md-9">
											<input class="form-control" id="hasHystrix" type="text"
												name="hasHystrix" placeholder="是否熔断">
										</div>
									</div>
									<div class="form-group row">
										<label class="col-md-2 col-form-label control-label"
											for="text-input">是否可访问</label>
										<div class="col-md-9">
											<input class="form-control" id="hasOpen" type="text"
												name="hasOpen" placeholder="是否可访问">
										</div>
									</div>
									<div class="form-group row">
										<label class="col-md-2 col-form-label control-label"
											for="text-input">熔断器内容</label>
										<div class="col-md-9">
											<input class="form-control" id="hystrixContent" type="text"
												name="hystrixContent" placeholder="熔断器内容">
										</div>
									</div>
									<div class="form-group row">
										<label class="col-md-2 col-form-label control-label"
											for="text-input">限流</label>
										<div class="col-md-9">
											<input class="form-control" id="limitRequest" type="text"
												name="limitRequest" placeholder="限流">
										</div>
									</div>
									<div class="form-group row">
										<label class="col-md-2 col-form-label control-label"
											for="text-input">服务端超时时间</label>
										<div class="col-md-9">
											<input class="form-control" id="serverOuttime" type="text"
												name="serverOuttime" placeholder="服务端超时时间">
										</div>
									</div>
									<div class="form-group row">
										<label class="col-md-2 col-form-label control-label"
											for="text-input">禁止关闭时间</label>
										<div class="col-md-9">
											<div class="input-group date">
												<span class="input-group-addon"><i
													class="fa fa-calendar"></i></span> <input type="text"
													class="form-control time-input" id="closeTime-3"
													name="closeTime" data-type="datetime"
													data-format="yyyy-MM-dd HH:mm:ss"
													placeholder="yyyy-MM-dd HH:mm:ss" lay-key="closeTime-3">
											</div>
										</div>
									</div>
									<div class="form-group row">
										<label class="col-md-2 col-form-label control-label" for="text-input">解密代码</label>
										<div class="col-md-9">
											<input class="form-control" id="decodeStr" type="text" name="decodeStr" placeholder="解密代码">
										</div>
									</div>
									<div class="form-group row">
										<label class="col-md-2 col-form-label control-label"
											for="text-input">全局头部</label>
										<div class="col-md-9">
											<input class="form-control" id="globalHeader" type="text"
												name="globalHeader" placeholder="全局头部">
										</div>
									</div>
									<div class="form-group row">
										<label class="col-md-2 col-form-label control-label"
											for="text-input">开始访问时间</label>
										<div class="col-md-9">
											<div class="input-group date">
												<span class="input-group-addon"><i
													class="fa fa-calendar"></i></span> <input type="text"
													class="form-control time-input" id="openTime-3"
													name="openTime" data-type="datetime"
													data-format="yyyy-MM-dd HH:mm:ss"
													placeholder="yyyy-MM-dd HH:mm:ss" lay-key="openTime-3">
											</div>
										</div>
									</div>
									 -->
									<div class="form-group row">
										<label class="col-md-2 col-form-label control-label" for="text-input">规则名称</label>
										<div class="col-md-9">
											<input class="form-control" id="name" type="text" name="name" placeholder="规则名称">
										</div>
									</div>
									<div class="form-group row">
										<label class="col-md-2 col-form-label control-label" for="text-input">规则前缀</label>
										<div class="col-md-9">
											<input class="form-control" id="uniquePrefix" type="text" name="uniquePrefix" placeholder="规则前缀">
										</div>
									</div>
									<div class="form-group row">
										<label class="col-md-2 col-form-label control-label" for="text-input">转发地址</label>
										<div class="col-md-9">
											<input class="form-control" id="forwardUrl" type="text" name="forwardUrl" placeholder="转发地址">
										</div>
									</div>
									<div class="form-group row">
										<label class="col-md-2 col-form-label control-label" for="text-input">服务端超时时间</label>
										<div class="col-md-9">
											<input class="form-control" id="serverOuttime" type="text" name="serverOuttime" placeholder="服务端超时时间">
										</div>
									</div>
									<div class="form-group row">
										<label class="col-md-2 col-form-label control-label" for="text-input">重试次数</label>
										<div class="col-md-9">
											<input class="form-control" id="retrics" type="text" name="retrics" placeholder="重试次数">
										</div>
									</div>
								</form>
							</div>
						</div>
					</div>
					<!-- /.col-->
				</div>
			</div>
		</div>

	</div>

	<footer th:replace="dashboard/footer :: footer"></footer>

	<script type="text/javascript">
		var addForm = $("#addForm");
		$(function() {
			addForm.validate({
				ignore : [],
				rules : {
					serverOuttime : {
						required : true,
						number : true
					},
					uniquePrefix : {
						required : true
					},
					name : {
						required : true
					},
					forwardUrl : {
						required : true , 
						url: true
					},
					retrics : {
						required : true,
						number : true
					}
				}
			});
		});

		function submitHandler() {
			var result = $.validate.form("addForm");
			if (result) {
				var saveUrl = ctx + "gateway/admin/gateRule/save";
				$.operate.save(saveUrl, addForm.serialize());
			}
		}
	</script>

</body>
</html>


